/**
 * Generali Solutions d'assurances - Tous droits réservés &copy; 2007 - 2010
 */
package fr.generali.accueilclient.utils.oxm;

import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;

/**
 * 
 * @author Holmes Kelly
 *
 */
public interface OxMapper {

    /**
     * Serializes assigned Object into a file with the assigned name.
     * 
     * @param object - Object that should be serialized
     * @param filename - name of the XML-file
     * @throws IOException exception has occurred
     */
    void writeObjectToXml(Object object, String filename) throws IOException;

    /**
     * Serializes assigned Object into a writer with the assigned name.
     * 
     * @param object - Object that should be serialized
     * @param writer writer
     */
    void writeObjectToXml(Object object, StringWriter writer);

    /**
     * Deserializes an object from the assigned file.
     * 
     * @param filename - name of the file that should be deserialized
     * @return deserialized object
     * @throws IOException exception has occurred
     */
    Object readObjectFromXml(String filename) throws IOException;

    /**
     * Deserializes an object from the assigned reader
     * 
     * @param reader that contains the stream to be deserialized
     * @return deserialized object
     */
    Object readObjectFromXml(StringReader reader);

}
